package com.util
{
	import mx.formatters.DateFormatter;
	
	
	public class dateManager
	{
		public static function diffTimeFormat(tmp_diffDay:int, tmp_diffTime:String):String {
				
				//trace("tmp_diffDay:"+tmp_diffDay+", tmp_diffTime : "+tmp_diffTime )
				
				var iDiffDay:uint 		= int(tmp_diffDay) - 1;
				var sDiffTime:String	= tmp_diffTime;
				var sDiff:String="";
				if(iDiffDay > 0) {
					sDiff = iDiffDay + "일 "; 
				}
				//00000:00:12
				var iFirstPosition:uint = sDiffTime.indexOf(":");
				var iHours:int = parseInt(sDiffTime.substring(0, iFirstPosition));
				var onlyHour:int = iHours%24; 
				
				if(onlyHour > 0 ) {					
					sDiff = sDiff + onlyHour + ":"
				}
				
				
				if(sDiffTime.substring(iFirstPosition+1, iFirstPosition+3) != "00") {
					sDiff = sDiff + sDiffTime.substring(iFirstPosition+1, iFirstPosition+3) + "분 "
				}
				if(sDiffTime.substring(iFirstPosition+4, iFirstPosition+6) != "00") {
					sDiff = sDiff + sDiffTime.substring(iFirstPosition+4, iFirstPosition+6) + "초 "
				}								
				sDiff = sDiff  + "전";
				var diff:String = sDiff;
				//trace("diff : " + diff);			
				return diff;
		}	

		public static function getDetailDate():String {
			var d:Date = new Date();
			var df:DateFormatter = new DateFormatter();
			df.formatString = 'YYYYMMDDHHNNSS';
			return df.format(d);
		}				
	}
}